/*******************************************************************************
* @Filename      : bsp_flash.h

* @Description   : bsp_flash.h

* @Version       : 1.0.0

* @Date          : 2023.12.2
*******************************************************************************/

#ifndef __BSP_FLASH_H
#define __BSP_FLASH_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "bsp.h"

/* Exported types ------------------------------------------------------------*/

/* Exported define -----------------------------------------------------------*/
#define FLASH_CS_SET() GPIO_SetBits(FLASH_CS_PORT,   FLASH_CS_PIN)
#define FLASH_CS_CLR() GPIO_ResetBits(FLASH_CS_PORT, FLASH_CS_PIN)

/* Exported constants --------------------------------------------------------*/

/* Exported variables --------------------------------------------------------*/

/* Exported functions --------------------------------------------------------*/
void BSP_FLASH_Init(void);
uint32_t BSP_FLASH_WriteByte(uint8_t data);
void SPI_FLASH_ReadDeviceID(void);
void SPI_FLASH_ReadJEDEC_ID(void);
void SPI_FLASH_FastRead(uint32_t Address, uint8_t *Buffer, uint32_t Length);
void SPI_FLASH_SectorErase(uint16_t Index);//4k Index
void SPI_FLASH_PageProgram(uint32_t Address, uint8_t *Buffer, uint32_t Length);
#ifdef __cplusplus
}
#endif
#endif

/* End of File ---------------------------------------------------------------*/
